package ve.ejb.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author memozac
 */
@Entity
public class Agreement implements Serializable {
    private static final long serialVersionUID = 1L;

    public enum Type{CUSTOM,ACTION_PLAN};

    @Id @GeneratedValue(strategy = GenerationType.AUTO) private Long idAgreement;

    @ManyToOne private Topic topic;

    @ManyToOne private SRMTopic SRMTopic;

    @OneToOne private ActionPlan actionPlan;

    @Temporal(value = TemporalType.TIMESTAMP) private Date registerDate;

    @Column(columnDefinition="text") private String agreement;

    @Enumerated private Type type;

    public Date getRegisterDate() {
        return registerDate;
    }

    public void setRegisterDate(Date registerDate) {
        this.registerDate = registerDate;
    }

    public Type getType() {
        return type;
    }

    public void setType(Type type) {
        this.type = type;
    }

    public String getAgreement() {
        return agreement;
    }

    public void setAgreement(String agreement) {
        this.agreement = agreement;
    }

    public SRMTopic getSRMTopic() {
        return SRMTopic;
    }

    public void setSRMTopic(SRMTopic SRMTopic) {
        this.SRMTopic = SRMTopic;
    }

    public ActionPlan getActionPlan() {
        return actionPlan;
    }

    public void setActionPlan(ActionPlan actionPlan) {
        this.actionPlan = actionPlan;
    }

    public Long getIdAgreement() {
        return idAgreement;
    }

    public void setIdAgreement(Long idAgreement) {
        this.idAgreement = idAgreement;
    }

    public Topic getTopic() {
        return topic;
    }

    public void setTopic(Topic topic) {
        this.topic = topic;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idAgreement != null ? idAgreement.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof Agreement)) {
            return false;
        }
        Agreement other = (Agreement) object;
        if ((this.idAgreement == null && other.idAgreement != null) || (this.idAgreement != null && !this.idAgreement.equals(other.idAgreement))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ve.ejb.entity.Agreement[id=" + idAgreement + "]";
    }

}//ends of class
